import 'package:flutter_nb_net/flutter_net.dart';

class CardPackagesResp extends BaseNetModel {
  int? code;
  String? msg;
  CardPackagesData? data;

  CardPackagesResp({this.code, this.msg, this.data});

  @override
  fromJson(Map<String, dynamic> json) {
    return CardPackagesResp(
      code: json['code'],
      msg: json['msg'],
      data: json['data'] == null ? null : CardPackagesData().fromJson(json['data']),
    );
  }
}

class CardPackagesData extends BaseNetModel {
  String? iccid;
  String? cardNo;
  PackageInfo? mainPackageInfo;
  List<PackageInfo>? additionalPackageInfo;

  CardPackagesData({this.iccid, this.cardNo, this.mainPackageInfo, this.additionalPackageInfo});

  @override
  fromJson(Map<String, dynamic> json) {
    return CardPackagesData(
      iccid: json['iccid'],
      cardNo: json['cardNo'],
      mainPackageInfo: json['mainPackageInfo'] == null ? null : PackageInfo().fromJson(json['mainPackageInfo']),
      additionalPackageInfo: json['additionalPackageInfo'] == null ? null : List<PackageInfo>.from(json['additionalPackageInfo'].map((x) => PackageInfo().fromJson(x))),
    );

  }
}

class PackageInfo extends BaseNetModel {
  num? packageId;
  int? packageType;

  String? packageCode;
  num? price;
  double? consumption;
  String? packageName;
  int? timeLength;
  String? timeUnit;

  PackageInfo({this.packageCode, this.price, this.consumption, this.packageName, this.timeLength, this.timeUnit, this.packageId, this.packageType});

  @override
  fromJson(Map<String, dynamic> json) {
    return PackageInfo(
      packageCode: json['packageCode'],
      price: json['price'],
      consumption: json['consumption'],
      packageName: json['packageName'],
      timeLength: json['timeLength'],
      timeUnit: json['timeUnit'],
      packageId: json['packageId'],
      packageType: json['packageType'],
    );
  }

  Map<String, dynamic> toJson() => {
    "packageCode": packageCode,
    "price": price,
    "consumption": consumption,
    "packageName": packageName,
    "timeLength": timeLength,
    "timeUnit": timeUnit,
    "packageId": packageId,
    "packageType": packageType,
  };
}




class PackageMenuInfoResp extends BaseNetModel {
  int? code;
  String? msg;
  List<PackageMenuInfo>? data;

  PackageMenuInfoResp({this.code, this.msg, this.data});

  @override
  fromJson(Map<String, dynamic> json) {
    return PackageMenuInfoResp(
      code: json['code'],
      msg: json['msg'],
      data: json['data'] == null ? null : List<PackageMenuInfo>.from(json['data'].map((x) => PackageMenuInfo().fromJson(x))),

    );
  }
}



// 套餐模型
class PackageMenuInfo extends PackageMenuInfoResp {
  String? createBy;
  String? createTime;

  String? updateBy;
  int? packageId;
  int? type;
  String? title;
  String? subtitle;
  num? price;
  String? content;
  int? number;
  int? status;

  PackageMenuInfo({this.createBy, this.createTime, this.updateBy, this.packageId, this.type, this.title, this.subtitle, this.price, this.content, this.number, this.status});

  @override
  fromJson(Map<String, dynamic> json) {
    return PackageMenuInfo(
      createBy: json['createBy'],
      createTime: json['createTime'],
      updateBy: json['updateBy'],
      packageId: json['packageId'],
      type: json['type'],
      title: json['title'],
      subtitle: json['subtitle'],
      price: json['price'],
      content: json['content'],
      number: json['number'],
      status: json['status'],
    );
  }

  Map<String, dynamic> toJson() =>
      {
        "createBy": createBy,
        "createTime": createTime,
        "updateBy": updateBy,
        "packageId": packageId,
        "type": type,
        "title": title,
        "subtitle": subtitle,
        "price": price,
        "content": content,
        "number": number,
        "status": status,
      };
}

